home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
progjour
/
1991
/
01
/
menukey.prg
< prev
next >
Wrap
Text File
|
1990-06-04
|
3KB
|
86 lines
*** MENUKEY.PRG
* Author: M. Steven Baker
private m_row,m_col
notfound = .T.
DO WHILE notfound
IF (remenu)
@ 23,0 CLEAR to 24,79 && clear menubar area
@ 23,3 SAY menuline
IF (menusel <1 .OR. menusel > menu_max)
menusel = 1
ENDIF
SET COLOR TO N/W
@ 23,VAL(SUBSTR(menubar(menusel),1,2)) ;
SAY SUBSTR(menubar(menusel),3,LEN(menubar(menusel))-2)
SET COLOR TO W/N
@ 24,3 SAY menuhelp(menusel)
ENDIF
badkey = .T.
DO WHILE (badkey)
choice = 0
DO WHILE (choice = 0)
choice = inkey()
ENDDO
m_row = row() && save cursor position
m_col =col()
@ 0,60 CLEAR to 0,78 && clear error line at top
@ m_row,m_col SAY "" && restore cursor position
IF (choice >32 .AND. choice <127) && an ASCII char?
choice = UPPER(CHR(choice))
m = 1
DO WHILE (m <= menu_max .AND. badkey)
IF ( SUBSTR(menuchoice,m,1) = choice)
notfound = .F.
badkey = .F.
menusel = m
ELSE
m = m+1
ENDIF
ENDDO
ELSE
badkey = .F.
DO CASE
CASE choice = 4 && right arrow
IF (menusel < menu_max )
menusel = menusel +1
ELSE
menusel = 1
ENDIF
choice = SUBSTR(menuchoice,menusel,1)
CASE choice = 19 && left arrow
IF (menusel = 1)
menusel = menu_max
ELSE
menusel = menusel - 1
ENDIF
choice = SUBSTR(menuchoice,menusel,1)
CASE choice = 13 && return
choice = SUBSTR(menuchoice,menusel,1)
notfound = .F.
CASE choice = 32 && space bar - advance right
IF (menusel < menu_max )
menusel = menusel +1
ELSE
menusel = 1
ENDIF
choice = SUBSTR(menuchoice,menusel,1)
CASE choice = 9 && tab key - advance right
IF (menusel < menu_max )
menusel = menusel +1
ELSE
menusel = 1
ENDIF
choice = SUBSTR(menuchoice,menusel,1)
OTHERWISE
badkey = .T.
notfound = .T.
ENDCASE
ENDIF
ENDDO && do while(badkey)
ENDDO && while notfound
RETURN